<template>
   <div>
         <div class="top">
            搜索条件
            <div class="select">
                <div class="com">企业名称：<el-input v-model="enterpriseName" placeholder="请输入企业名称"></el-input></div>
                <div class="name">法人姓名：<el-input v-model="realName" placeholder="请输入法人姓名"></el-input></div>
                <div class="phone">法人电话：<el-input v-model="phone" placeholder="请输入法人电话"></el-input></div>
                <el-button class="found" type="primary" @click="found">查询</el-button>
            </div>
        </div>
        <div>
            <ul>
                <li>企业总数：{{this.total}}</li>
                <li>会员总数：{{this.huiyuan}}</li>
            </ul>
             <el-table
                :data="list"
                style="width: 100%"
                :header-cell-style="{
                    'border-bottom': '5px solid #eee'
                }"
                >
                <el-table-column
                    prop="enterpriseName"
                    label="公司名称"
                    width="200"
                    show-overflow-tooltip
                    >
                </el-table-column>
                <el-table-column
                    prop="realName"
                    label="法人姓名"
                    width="200">
                </el-table-column>
                <el-table-column
                    prop="phone"
                    width="200"
                    label="法人电话">
                </el-table-column>
                <el-table-column
                    prop="socialCreditCode"
                    width="220"
                    label="社会信用代码">
                </el-table-column>
                <el-table-column
                    prop="accountTotal"
                    width="200"
                    label="账户余额">
                </el-table-column>
                <el-table-column
                    fixed="right"
                    label="操作"
                    min-width="200">
                    <template slot-scope="scope">
                    <el-button @click="look(scope.row)" type="text" size="small">查看详情</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <el-pagination
                background
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="pageIndex"
                :page-size="pageSize"        
                layout="prev, pager, next"
                :total="total"
                >
            </el-pagination>
        </div>
   </div>
</template>
<script>
   
    export default {
        data() {
            return {
                list:[],
                pageIndex:1,
                pageSize:5,
                total:0,
                enterpriseName:'',
                realName:'',
                phone:"",
                huiyuan:0
                
            }
        },
        created(){
            this.userList()
            // this.currentChangePage()
        },
       
        methods: { 
          
            //查询
            found(){
                this.$axios({
                    method: 'get',
                    url: '/laowuUser/selectUser',
                    params: {
                        pageIndex:this.pageIndex,
                        pageSize:this.pageSize,
                        enterpriseName:this.enterpriseName,
                        realName:this.realName,
                        phone:this.phone
                    }
                    }).then(res=>{
                        // console.log(res.data.data.list);
                        this.list = res.data.data.list
                        // console.log(this.list)
                    },err=>{
                        console.log(err);
                })
            },
          
            //分页
            handleSizeChange: function(pageSize) { // 每页条数切换
                this.pageSize = pageSize
                
                this.handleCurrentChange(this.pageIndex);
            },
            handleCurrentChange: function(pageIndex) {//页码切换
                this.pageIndex = pageIndex
                // this.currentChangePage(this.list,pageIndex)
                this.userList()
               
            },
         
           userList(){
                this.$axios({
                    method: 'get',
                    url: '/laowuUser/selectUser',
                    params: {
                        pageIndex:this.pageIndex,
                        pageSize:this.pageSize,
                        enterpriseName:'',
                        realName:'',
                        phone:''
                    }
                    }).then(res=>{
                        // console.log(res.data.data.list);
                        this.list = res.data.data.list
                        this.total = res.data.data.total
                        this.huiyuan = res.data.data.huiyuanCount
                        // console.log(this.list)
                    },err=>{
                        console.log(err);
                })
           },
           look(row){
               console.log(row)
               this.$axios({
                    method: 'get',
                    url: '/laowuUser/enterpriseInformation',
                    params: {
                        id:row.id
                    }
                    }).then(res=>{
                        console.log(res.data);
                        if(res.data.code = 200){
                            this.$router.push({
                                name:'Details',
                                params:{
                                    enterpriseName:row.enterpriseName,
                                    realName:row.realName,
                                    idCard:row.idCard,
                                    phone:row.phone,
                                    socialCreditCode:row.socialCreditCode,
                                    bank:row.bank,
                                    bankCardNumber:row.bankCardNumber,
                                    id:row.id,
                                    zhengIdCardUrl:res.data.data.zhengIdCardUrl,
                                    fanIdCardUrl:res.data.data.fanIdCardUrl,
                                    businessLicense:res.data.data.businessLicense,
                                }
                            })
                        }
                    },err=>{
                        console.log(err);
                })
            
           }


        }
  }
</script>

<style>
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
  box-sizing: border-box;
}
li {
  display: inline-block;
  /* margin: 0 10px; */
  
}
a {
  text-decoration: none;
  color: #0263D5;
}
.top .select{
    /* width: 1040px; */
    height: 90px;
    /* line-height: 90px; */
    background: #FFFFFF;
    display: flex;
    /* justify-content: space-around; */
    align-items: center;
    margin-top: 16px;
    margin-bottom: 28px;
}
.top .select .com{
    margin-left: 20px;
    margin-right: 60px;
}
.top .select .name{
    margin-right: 60px;
}
.top .select .el-input{
    border: none;
    width: 200px;
    height: 30px;
    background: #FFFFFF;
    border-radius: 2px;
    /* border: 1px solid #D5DAE1; */
}

.found{
    width: 100px;
    height: 40px;
    /* line-height: 40px; */
    background: #108EE9;
    border-radius: 3px;
    margin-left: 40px;
    margin-top: 8px;
}
.demo-form-inline{
    /* // width: 1040px; */
    height: 90px;
    /* // line-height:90px; */
    background: #FFFFFF;
    display:flex;
    justify-content:space-around;
    align-items:center;
    margin-top:14px;
}
.el-input{
    margin-left:10px;
}

.el-table{
    /* width: 1040px; */
    height: 316px;
    background: #FFFFFF;
    margin-top: 16px;
}
.el-table-column{
    margin-left: 20px;
}
.el-pagination{
    /* padding-left: 600px; */
    background: #fff;
}
</style>